<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>今日股票</title>
    <script type="text/javascript" src="http://hq.sinajs.cn/list=s_sh000001,s_sz399001,s_sz399005,s_sz399006"
            charset="GB2312"></script>
    <script type="text/javascript">
        /**
         * let hq_str_s_sh000001="上证指数,3278.2409,23.6130,0.73,1611837,14935097";
         let hq_str_s_sz399001="深证成指,13004.73,142.977,1.11,289518470,29962878";
         let hq_str_s_sz399005="中小板指,8626.60,139.863,1.65,14008786,2749163";
         let hq_str_s_sz399006="创业板指,2554.33,30.935,1.23,20450978,3681199";
         */

        const show = function () {

            // http://quote.eastmoney.com/zs000001.html
            // http://quote.eastmoney.com/zs399001.html
            // http://quote.eastmoney.com/zs399005.html
            // http://quote.eastmoney.com/zs399006.html

            // 开盘价
            let kp_s01 = 3514.56;
            let kp_z01 = 14480.74;
            let kp_z05 = 9712.72;
            let kp_z06 = 2907.48;

            let s01 = hq_str_s_sh000001.split(",");
            let z01 = hq_str_s_sz399001.split(",");
            let z05 = hq_str_s_sz399005.split(",");
            let z06 = hq_str_s_sz399006.split(",");

            doShow("s01", [document.getElementById("s01_0").value || kp_s01, s01[1], s01[3]]);
            doShow("z01", [document.getElementById("z01_0").value || kp_z01, z01[1], z01[3]]);
            doShow("z05", [document.getElementById("z05_0").value || kp_z05, z05[1], z05[3]]);
            doShow("z06", [document.getElementById("z06_0").value || kp_z06, z06[1], z06[3]]);
        };

        const doShow = function (index, data) {

            document.getElementById(index + "_1").textContent = data[0];
            document.getElementById(index + "_2").textContent = Math.round(data[1] * 100) / 100;
            let zd = "涨";
            let bl = Math.round(data[2] * 100) / 100;
            if (bl < 0) {
                zd = "跌";
                bl = 0 - bl;
            }
            document.getElementById(index + "_3").textContent = bl;
            document.getElementById(index + "_4").textContent = zd;
        }
    </script>
</head>
<body>
<input type=text placeholder="上证开盘" id="s01_0">
<input type=text placeholder="深证开盘" id="z01_0">
<input type=text placeholder="中小开盘" id="z05_0">
<input type=text placeholder="创业开盘" id="z06_0">
<input type="button" value="生成" onclick="show()">
<pre>

倒计时15分钟
上证指数  今日开盘：<label id="s01_1"></label>
                 最新指数：<label id="s01_2"></label>
深证成指  今日开盘：<label id="z01_1"></label>
                 最新指数：<label id="z01_2"></label>
中小板指  今日开盘：<label id="z05_1"></label>
                 最新指数：<label id="z05_2"></label>
创业板指  今日开盘：<label id="z06_1"></label>
                 最新指数：<label id="z06_2"></label>
截止目前，沪指   <label id="s01_4"></label>  <label id="s01_3"></label>%；深圳成指   <label id="z01_4"></label>  <label
        id="z01_3"></label>%；中小板   <label id="z05_4"></label>  <label id="z05_3"></label>%；创业板指    <label
        id="z06_4"></label>  <label id="z06_3"></label>%

</pre>

</body>
</html>
